﻿using Huirui.Cavan.Domain.Seedwork;
using System;
using System.Collections;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    #region Currency

    /// <summary>
    /// Currency object for NHibernate mapped table 'Currency'.
    /// </summary>
    [Serializable]
    public class Currency : Persistent
    {
        #region Member Variables
        protected string _code;
        protected string _name;
        protected decimal _rate;
        protected bool _isLocal;
        protected Corporation _corporation;

        #endregion

        #region Constructors

        public Currency() { }

        public Currency(string code, string name, decimal rate, bool isLocal, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation)
        {
            this._code = code;
            this._name = name;
            this._rate = rate;
            this._isLocal = isLocal;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
        }

        #endregion

        #region Public Properties
        public virtual string Code
        {
            get { return _code; }
            set
            {
                if (value != null && value.Length > 4)
                    throw new ArgumentOutOfRangeException("Invalid value for Code", value, value.ToString());
                _code = value;
            }
        }

        public virtual string Name
        {
            get { return _name; }
            set
            {
                if (value != null && value.Length > 20)
                    throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
                _name = value;
            }
        }

        public virtual decimal Rate
        {
            get { return _rate; }
            set { _rate = value; }
        }

        public virtual bool IsLocal
        {
            get { return _isLocal; }
            set { _isLocal = value; }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }


        #endregion
    }
    #endregion
}